//
//  PlayManager.h
//  Education
//
//  Created by Eric on 17/6/22.
#import <AVFoundation/AVFoundation.h>


@protocol PlayManagerDelegate <NSObject>

@optional;
//第一个参数：播放器对象
//第二个参数：当前播放进度0-1
//第三个参数：当前歌曲的总时长
- (void)playerWithPlayer:(AVPlayer *)player
                progress:(float)progress
                duration:(float)duration currentTime:(float)currentTime;

- (void)musicFinsh;

- (void)playStateChange:(AVPlayerItemStatus)state;


@end

@interface PlayManager : NSObject

@property (nonatomic, weak)id<PlayManagerDelegate> delegate;

@property (nonatomic, strong)AVAudioSession *avsession;
@property (nonatomic, strong)AVPlayer *myPlayer;

@property (nonatomic, assign) double useTime;//做题用时

@property (nonatomic, assign) BOOL isBeginTest;//是否开始答题

+ (PlayManager *)sharPlayManager;

- (void)playerWithURL:(NSString *)usrString;

- (NSUInteger)getDurationWithUrlString:(NSString *)urlStr;

- (void)play;
- (void)pause;


- (void)playwhichway:(BOOL)speaker;
//是否在播放状态
- (Boolean)isPlaying; //是否是在播放状态

@end
